/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cw;

import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.light.SpotLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import jme3tools.optimize.GeometryBatchFactory;

/**
 *
 * @author Wesley
 */
public class ConsoleWars extends SimpleApplication {

    @Override
    public void simpleInitApp() {

        flyCam.setMoveSpeed(10);
        flyCam.setRotationSpeed(2);

        /**
         * A white, spot light source.
         */
        //PointLight lamp = new PointLight();
        // lamp.setPosition(Vector3f.ZERO);
        // lamp.setColor(ColorRGBA.White);
        // rootNode.addLight(lamp);
        /**
         * A white ambient light source.
         */
        AmbientLight ambient = new AmbientLight();
        ambient.setColor(ColorRGBA.White);
        rootNode.addLight(ambient);

        /**
         * A white, directional light source
         */
        // DirectionalLight sun = new DirectionalLight();
        // sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
        // sun.setColor(ColorRGBA.White);
        // rootNode.addLight(sun);
        /**
         * A cone-shaped spotlight with location, direction, range
         */
        SpotLight spot = new SpotLight();
        spot.setSpotRange(100);
        spot.setSpotOuterAngle(20 * FastMath.DEG_TO_RAD);
        spot.setSpotInnerAngle(15 * FastMath.DEG_TO_RAD);
        spot.setDirection(cam.getDirection());
        spot.setPosition(cam.getLocation());
        rootNode.addLight(spot);

        // Add my shelf for testing
        Spatial shelf = assetManager.loadModel("Models/VideoGameStore.j3o");
        Spatial optimize = GeometryBatchFactory.optimize((Node) shelf);
        
        rootNode.attachChild(optimize);
        viewPort.setBackgroundColor(ColorRGBA.Pink);
    }
}